package base;

import lombok.Data;

/**
 * 泛型接口
 *
 * @author 王霄
 * @date 2021/10/11 12:50
 **/
public class GenericInterfaceDemo {

    public static void main(String[] args) {
        A<String> b = new B<>();
        System.out.println(b.get("王晓"));

        A<String> c = new C();
        System.out.println(c.get("王晓"));
    }


    public interface A<T> {
        T get(T a);
    }

    @Data
    public static class B<T> implements A<T> {
        @Override
        public T get(T a) {
            return a;
        }
    }

    @Data
    public static class C implements A<String> {
        @Override
        public String get(String a) {
            return "你好" + a;
        }
    }
}
